var e = require;
var t = module;
var o = exports;
var n,
    i = o,
    a =
        ((n = function (e, t) {
            return (n =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (e, t) {
                        e.__proto__ = t;
                    }) ||
                function (e, t) {
                    for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
                })(e, t);
        }),
        function (e, t) {
            function o() {
                this.constructor = e;
            }
            n(e, t), (e.prototype = null === t ? Object.create(t) : ((o.prototype = t.prototype), new o()));
        });
Object.defineProperty(i, "__esModule", {value: !0}), (i.BevNodeLoop = void 0);
var r = e("BehaviorTree"),
    s = (function (e) {
        function t(o, n, i) {
            void 0 === n && (n = null), void 0 === i && (i = t.kInfiniteLoop);
            var a = e.call(this, o, n) || this;
            return (a.mi_LoopCount = i), (a.mi_CurrentCount = 0), a;
        }
        return (
            a(t, e),
            (t.prototype._DoEvaluate = function (e) {
                return (
                    (this.mi_LoopCount === t.kInfiniteLoop || this.mi_CurrentCount < this.mi_LoopCount) &&
                    !(!this._bCheckIndex(0) || !this.mao_ChildNodeList[0].Evaluate(e))
                );
            }),
            (t.prototype._DoTransition = function (e) {
                this._bCheckIndex(0) && this.mao_ChildNodeList[0].Transition(e), (this.mi_CurrentCount = 0);
            }),
            (t.prototype._DoTick = function (e, o) {
                var n = r.BevRunningStatus.k_BRS_Finish;
                return (
                    this._bCheckIndex(0) &&
                        (n = this.mao_ChildNodeList[0].Tick(e, o)) === r.BevRunningStatus.k_BRS_Finish &&
                        (this.mi_LoopCount != t.kInfiniteLoop
                            ? (this.mi_CurrentCount++,
                              this.mi_CurrentCount < this.mi_LoopCount && (n = r.BevRunningStatus.k_BRS_Executing))
                            : (n = r.BevRunningStatus.k_BRS_Executing)),
                    n && (this.mi_CurrentCount = 0),
                    n
                );
            }),
            (t.kInfiniteLoop = -1),
            t
        );
    })(e("BevNode").BevNode);
i.BevNodeLoop = s;
